<!-- 公共头 -->
<%
var path = request.ContextPath;
var basePath = request.Scheme +"://"+request.ServerName+":"+request.ServerPort+path+"/";
var staticPath = basePath + "static";
%>
<link rel="import" href="${staticPath}/page/common/header.html">
<meta charset="UTF-8">
<link rel="stylesheet" href="${staticPath}/css/login.css">

<body class="layui-main">
    <div class="login-box">
        <form class="layui-form" method="post" action="/login">
            <h1 class="text-center text-login">登 录</h1>
            <hr class="layui-bg-green">

            <div class="margin-top-20">
                <div class="layui-form-item">
                    <label class="layui-form-label" >用户名</label>
                    <div class="layui-input-block">
                        <input type="text"  required name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" value="${!(username)}" class="layui-input input-width">
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" id="password" required lay-verify="required"
                               placeholder="请输入密码" autocomplete="off" class="layui-input input-width" onblur="encryption()">
                    </div>
                </div>

                <div >
                    <div class="layui-form-item">
                        <label class="layui-form-label">记住我</label>
                        <div class="layui-input-inline" id="remberDiv">
                            <input type="checkbox" name="remberMe" lay-skin="switch" lay-text="ON|OFF">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <p id="errMsg">${!(error)}</p>
                        </div>
                    </div>

                    <div class="layui-form-item margin-top-10">
                        <div class="layui-input-block">
                            <button class="layui-btn" type="submit">登录</button>
                            <button type="reset" id="btn-reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</body>
<!-- 公共页脚 -->
<link rel="import" href="${staticPath}/page/common/footer.html">
<script>
    function encryption() {
        if($("#password").val() != '' && $("#password").val() != null && $("#password").val().length < 15){
            $("#password").val($.md5($("#password").val()))
        }
    }
    $("body").keydown(function() {
        if (event.keyCode == "13") {
            encryption();
        }
    });
</script>